/**
 * 
 */
package com.googlecode.xcarve.common.config;

import java.io.Serializable;

import com.alibaba.fastjson.JSONObject;

/**
 * @author duxinyun
 *
 */
public class ServiceInfo implements Serializable{
	private static final long serialVersionUID = -6553389876876304281L;

	private String interfaceName;// 接口
	private String version;
	private Integer maxRequest;
	private boolean exported;
	private String domain;
	private long timeStamp;
	private String host;
	private int port;
	
	public String getInterfaceName() {
		return interfaceName;
	}

	public void setInterfaceName(String interfaceName) {
		this.interfaceName = interfaceName;
	}

	public String getVersion() {
		return version;
	}

	public void setVersion(String version) {
		this.version = version;
	}

	public Integer getMaxRequest() {
		return maxRequest;
	}

	public void setMaxRequest(Integer maxRequest) {
		this.maxRequest = maxRequest;
	}

	public boolean isExported() {
		return exported;
	}

	public void setExported(boolean exported) {
		this.exported = exported;
	}

	public String getDomain() {
		return domain;
	}

	public void setDomain(String domain) {
		this.domain = domain;
	}

	public long getTimeStamp() {
		return timeStamp;
	}

	public void setTimeStamp(long timeStamp) {
		this.timeStamp = timeStamp;
	}

	public String getHost() {
		return host;
	}

	public void setHost(String host) {
		this.host = host;
	}
	
	public int getPort() {
		return port;
	}

	public void setPort(int port) {
		this.port = port;
	}
	
	public String getAddress(){
		return this.getHost()+":"+getPort();
	}
	
	@Override
	public String toString() {
		return JSONObject.toJSONString(this);
	}
	
	public ServiceInfo decode(String text){
		return JSONObject.parseObject(text, getClass());
	}
	
	public String encode(){
		return JSONObject.toJSONString(this);
	}
}
